.PHONY: start build lint test proto format

start:
	@go run main.go

build:
	docker build -f build/docker/Dockerfile -t disk_manager .

run:
	docker-compose -f build/docker/docker-compose.yaml up

lint:
	@golangci-lint run ./...

test:
	go test -cover -v ./internal/...
	go test -cover -v ./pkg/...

proto:
	protoc --go_out=. --go_opt=paths=source_relative --go-grpc_out=. --go-grpc_opt=paths=source_relative pkg/proto/disk_manager.proto

format:
	@find -type f -name '*.go' | $(XARGS) gofmt -s -w
	@find -type f -name '*.go' | $(XARGS) goimports -w -local "gitlab.yctc.tech"

.PHONY: install.golangci-lint
install.golangci-lint:
	@go get -u github.com/golangci/golangci-lint/cmd/golangci-lint

.PHONY: install.goimports
install.goimports:
	@go get -u golang.org/x/tools/cmd/goimports
